package com.ruoyi.dl.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dl.mapper.DlCouponsMapper;
import com.ruoyi.dl.domain.DlCoupons;
import com.ruoyi.dl.service.IDlCouponsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 优惠券Service业务层处理
 *
 * @author ruoyi
 * @date 2020-12-28
 */
@Service
public class DlCouponsServiceImpl implements IDlCouponsService {
    @Autowired
    private DlCouponsMapper dlCouponsMapper;

    /**
     * 查询优惠券
     *
     * @param id 优惠券ID
     * @return 优惠券
     */
    @Override
    public DlCoupons selectDlCouponsById(Long id) {
        return dlCouponsMapper.selectDlCouponsById(id);
    }

    /**
     * 根据userid查询个人优惠券
     *
     * @param userId 用户id
     * @return 优惠券
     */
    @Override
    public DlCoupons selectDlCouponsByUserId(Integer userId) {
        return dlCouponsMapper.selectDlCouponsByUserId(userId);
    }

    /**
     * 查询优惠券列表
     *
     * @param dlCoupons 优惠券
     * @return 优惠券
     */
    @Override
    public List<DlCoupons> selectDlCouponsList(DlCoupons dlCoupons) {
        return dlCouponsMapper.selectDlCouponsList(dlCoupons);
    }

    /**
     * 新增优惠券
     *
     * @param dlCoupons 优惠券
     * @return 结果
     */
    @Override
    public int insertDlCoupons(DlCoupons dlCoupons) {
        return dlCouponsMapper.insertDlCoupons(dlCoupons);
    }

    /**
     * 修改优惠券
     *
     * @param dlCoupons 优惠券
     * @return 结果
     */
    @Override
    public int updateDlCoupons(DlCoupons dlCoupons) {
        return dlCouponsMapper.updateDlCoupons(dlCoupons);
    }

    /**
     * 删除优惠券对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteDlCouponsByIds(String ids) {
        return dlCouponsMapper.deleteDlCouponsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除优惠券信息
     *
     * @param id 优惠券ID
     * @return 结果
     */
    @Override
    public int deleteDlCouponsById(Long id) {
        return dlCouponsMapper.deleteDlCouponsById(id);
    }
}
